package cn.tedu._07springaop.egaop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LogAspect1 {

    @Around("execution(public boolean cn.tedu._07springaop.egaop.CartServiceImpl.*(..))")
    public boolean aroundMethod(ProceedingJoinPoint joinPoint){
        boolean result = false;
        try {
            System.out.println("开始添加购物车");
            result = (boolean) joinPoint.proceed();
            if (result){
                System.out.println("添加购物车成功");
            }else {
                System.out.println("添加购物车失败");
            }
        } catch (Throwable e){
            System.out.println("xxxxx");
        } finally {
            System.out.println("操作完成");
        }

        return result;
    }
}









